#ifndef SCENE_H
#define SCENE_H

#include "vector.h"
#include "shape.h"
#include "camera.h"
#include "ray.h"
#include "csg.h"

#include <QObject>
#include <QString>
#include <QVector>
#include <QDataStream>

class Scene: public QObject
{
    Q_OBJECT

    QString _name;
    Camera* _camera;
    QVector<Shape*> _shapes;
    CSG* _csg;

public:
    explicit Scene (QString name, Camera *camera, QObject* parent = 0);
    ~Scene();
    const QVector<Shape*> &shapes() const;
    const QVector<Shape*> emitters() const ;
    const Shape *shape(const QString name) const;
    bool removeShape(const QString name);
    void addShape(Shape *shape);
    void addShape(CSG *shape);
    QString name() const;
    void setName(QString value);
    const Shape* intersect(const Ray &ray, double &distance, Vector &normal) const;
    Camera *camera() const;
    void setCamera(Camera *value);

    friend QDataStream &operator<<(QDataStream &, const Scene &);
    friend QDataStream &operator>>(QDataStream &, Scene &);
};




#endif // SCENE_H
